using System;
using System.ComponentModel.DataAnnotations;

namespace JGSY.CMS.LowCode.Platform.Application.DTOs
{
    /// <summary>
    /// 部门数据传输对象
    /// 用于传输部门相关的数据信息，包括部门层级、负责人等
    /// </summary>
    public class DepartmentDto
    {
        /// <summary>
        /// 部门ID
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 部门名称
        /// </summary>
        [Required(ErrorMessage = "部门名称不能为空")]
        [StringLength(255, ErrorMessage = "部门名称长度不能超过255个字符")]
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 部门编码
        /// </summary>
        [StringLength(50, ErrorMessage = "部门编码长度不能超过50个字符")]
        public string? Code { get; set; }

        /// <summary>
        /// 父部门ID
        /// </summary>
        public long? ParentId { get; set; }

        /// <summary>
        /// 部门描述
        /// </summary>
        [StringLength(500, ErrorMessage = "部门描述长度不能超过500个字符")]
        public string? Description { get; set; }

        /// <summary>
        /// 部门负责人ID
        /// </summary>
        public long? ManagerId { get; set; }

        /// <summary>
        /// 联系电话
        /// </summary>
        [StringLength(20, ErrorMessage = "联系电话长度不能超过20个字符")]
        public string? Phone { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        [StringLength(255, ErrorMessage = "邮箱长度不能超过255个字符")]
        [EmailAddress(ErrorMessage = "邮箱格式不正确")]
        public string? Email { get; set; }

        /// <summary>
        /// 地址
        /// </summary>
        [StringLength(500, ErrorMessage = "地址长度不能超过500个字符")]
        public string? Address { get; set; }

        /// <summary>
        /// 部门层级
        /// </summary>
        public int Level { get; set; }

        /// <summary>
        /// 路径（用于快速查询）
        /// </summary>
        [StringLength(500, ErrorMessage = "路径长度不能超过500个字符")]
        public string? Path { get; set; }

        /// <summary>
        /// 排序权重
        /// </summary>
        public int SortOrder { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public byte Status { get; set; }

        /// <summary>
        /// 版本号
        /// </summary>
        public int Version { get; set; }

        /// <summary>
        /// 创建人ID
        /// </summary>
        public long CreatedBy { get; set; }

        /// <summary>
        /// 修改人ID
        /// </summary>
        public long? UpdatedBy { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedAt { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime UpdatedAt { get; set; }

        /// <summary>
        /// 创建人姓名
        /// </summary>
        public string? CreatorName { get; set; }

        /// <summary>
        /// 修改人姓名
        /// </summary>
        public string? UpdaterName { get; set; }

        /// <summary>
        /// 父部门名称
        /// </summary>
        public string? ParentName { get; set; }

        /// <summary>
        /// 部门负责人姓名
        /// </summary>
        public string? ManagerName { get; set; }

        /// <summary>
        /// 子部门数量
        /// </summary>
        public int ChildrenCount { get; set; }

        /// <summary>
        /// 用户数量
        /// </summary>
        public int UserCount { get; set; }

        /// <summary>
        /// 团队数量
        /// </summary>
    public int TeamCount { get; set; }
    /// <summary>
    /// 子部门集合
    /// </summary>
    public List<DepartmentDto> Children { get; set; } = new();
    }
}
